package com.sunway.lc.ftp.process;

import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.component.file.GenericFileMessage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import java.io.RandomAccessFile;

/**
 * camel下载的文件加入到缓存中
 * 主控文件需要解析除版本信息后加入缓存。其他文件只需要记录必要的文件信息
 * @author Heyyroup
 * @Description
 * @date 2021/9/24
 */
@Component
public class FileCacheProcessor implements Processor {
    private static Logger logger = LoggerFactory.getLogger(FileCacheProcessor.class);
    @Override
    public void process(Exchange exchange) throws Exception {
        GenericFileMessage<RandomAccessFile> inFileMessage = (GenericFileMessage<RandomAccessFile>) exchange.getIn();
        String fileName = inFileMessage.getGenericFile().getFileName();         //文件名
        logger.info("当前下载的文件名为：" + fileName);
    }
}
